package org.example.handler;

import lombok.extern.slf4j.Slf4j;
import org.example.common.Constants;
import org.example.common.LoginVo;
import org.example.utils.JWTUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutHandler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * 退出登录执行处理器
 */
@Slf4j
public class CustomLogoutHandler implements LogoutHandler {

    private RedisTemplate redisTemplate;


    public void setRedisTemplate(RedisTemplate redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    @Override
    public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
       /* String header = request.getHeader(Constants.TOKEN);
        LoginVo loginVo = JWTUtils.parseToken(header);
        log.info("退出用户信息：{}", loginVo.getUserId());*/
    }
}
